package com.shiyi.design.observer;

/**
 * @author wangzhanshuai
 * @date 2021/2/1 11:28 下午
 * @since 1.0
 */
public class DadListener implements ActionListener {

    @Override
    public void handle(ActionEvent event) {
        String reason = event.getReason();
        if("wakeUp".equals(reason)) {
            coax();
            Baby baby = (Baby) event.getSource();
            baby.stopCry();
        } else {
            System.out.println("dad sleeping......");
        }
    }

    private void coax() {
        System.out.println("put baby to bed......");
    }
}
